package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.factory.RemoteAppUserFallbackFactory;
import com.ruoyi.system.api.model.request.AppUserBalanceBatchOpetRequest;
import com.ruoyi.system.api.model.request.AppUserBalanceOpetRequest;
import com.ruoyi.system.api.model.user.AppUser;
import com.ruoyi.system.api.model.user.AppUserChum;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

/**
 * 用户服务
 *
 * @author ruoyi
 */
@FeignClient(contextId = "remoteAppUserService", value = ServiceNameConstants.YOUBAN_USER, fallbackFactory = RemoteAppUserFallbackFactory.class)
public interface RemoteAppUserService {
    /**
     * 通过用户id查询用户信息
     */
    @GetMapping("/app/user/getById/{userId}")
    public R<AppUser> getUserInfo(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 通过用户id查询用户关注的用户
     */
    @GetMapping("/app/user/attention/{userId}")
    public R<Set<Long>> getUserAttention(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 通过用户id查询用户关注的用户
     */
    @GetMapping("/app/user/isAttention/{userId}/{aimUserId}")
    public R<Integer> getUserIsAttention(@PathVariable("userId") Long userId, @PathVariable("aimUserId") Long aimUserId, @RequestHeader(SecurityConstants.RequestSource) String source);

    /**
     * 通过id获取用户密友关系
     */
    @GetMapping("/app/user-chum/getById/{id}")
    public R<AppUserChum> getUserChumInfo(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 双方互关及增加亲密度
     */
    @GetMapping("/app/user-attention/setAttention/{userId}/{aimUserId}/{intimacyNum}")
    public R<Integer> setAttention(@PathVariable("userId") Long userId, @PathVariable("aimUserId") Long aimUserId, @PathVariable("intimacyNum") Long intimacyNum, @RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 扣减余额
     */
    @PostMapping("/app/user-balance/docBalance")
    public R<Boolean> docBalance(@RequestBody AppUserBalanceOpetRequest request, @RequestHeader(SecurityConstants.RequestSource) String source);

    /**
     * 扣减余额
     */
    @PostMapping("/app/user-balance/aocBalance")
    public R<Boolean> aocBalance(@RequestBody AppUserBalanceOpetRequest request, @RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 批量增加余额
     */
    @PostMapping("/app/user-balance/aocBalanceByBatch")
    public void aocBalanceByBatch(@RequestBody AppUserBalanceBatchOpetRequest request, @RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 批量增加余额
     */
    @PostMapping("/app/user-chum/setChum/{id}/{aimUserId}")
    public R<Boolean> setChum(@PathVariable("id") Long id, @PathVariable("aimUserId") Long aimUserId, @RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 是否关注
     */
    @GetMapping("/app/user-attention/isMyFens/{userId}/{aimUserId}")
    public R<Integer> isMyFens(@PathVariable("userId") Long userId, @PathVariable("aimUserId") Long aimUserId, @RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 获取新人用户ids
     */
    @GetMapping("/app/user/getNewUser")
    public R<Set<Long>> getNewUser(@RequestHeader(SecurityConstants.RequestSource) String source);


    /**
     * 获取新人用户ids
     */
    @GetMapping("/app/user/getCityWide/{userId}")
    public R<Set<Long>> getCityWide(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.RequestSource) String source);
}
